import { Application } from 'egg';

export default (app: Application) => {
    const { STRING, CHAR } = app.Sequelize;
    const model = app.model.define('Employee', {
        employee_id: {
            type: CHAR(32),
            primaryKey: true,
        },//主键id
        employee_token: CHAR(32),//token
        employee_openId: STRING(50),//openid
        employee_nickname: STRING(50),//微信昵称
        employee_avaTarUrl: STRING(100),//微信头像
        employee_name: STRING(32),//姓名
        employee_head_portrait: STRING(250),//头像
        employee_account: STRING(32),//账号
        employee_password: STRING(50),//密码
        work_unit_id: CHAR(32),//单位id
        department_id: CHAR(32),//部门id
        position_id: CHAR(32),//职位id
        employee_status: CHAR(1),//用户状态（1：待审核，2：已通过，3：不通过，4：已停用）
        created_by: CHAR(32),//创建人
        updated_by: CHAR(32),//更新人
        is_delete: CHAR(1),//标识是否被删除（0：否，1：是）
    }, { tableName: 't_employee' });
    return model;
};

export class Employee {
    employee_id: string;
    employee_token: string;
    employee_openId: string;
    employee_nickname: string;
    employee_avaTarUrl: string;
    employee_name: string;
    employee_head_portrait:string;
    employee_account: string;
    employee_password: string;
    work_unit_id: string;
    department_id: string;
    position_id: string;
    employee_status: string;
    created_by: string;
    updated_by: string;
    is_delete: string;
}
